package net.lab1024.sa.admin.module.business.erp.poo.controller;

import net.lab1024.sa.admin.module.business.erp.poo.domain.form.PuordaAddForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.PuordaQueryForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.PuordaUpdateForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.vo.PuordaVO;
import net.lab1024.sa.admin.module.business.erp.poo.service.PuordaService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 请购单明细 Controller
 *
 * @Author AKITA
 * @Date 2025-07-23 17:54:19
 * @Copyright AKITA
 */

@RestController
@Tag(name = "请购单明细")
public class PuordaController {

    @Resource
    private PuordaService puordaService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/puorda/queryPage")

    public ResponseDTO<PageResult<PuordaVO>> queryPage(@RequestBody @Valid PuordaQueryForm queryForm) {
        return ResponseDTO.ok(puordaService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/puorda/add")

    public ResponseDTO<String> add(@RequestBody @Valid PuordaAddForm addForm) {
        return puordaService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/puorda/update")

    public ResponseDTO<String> update(@RequestBody @Valid PuordaUpdateForm updateForm) {
        return puordaService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/puorda/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return puordaService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/puorda/delete/{id}")

    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return puordaService.delete(id);
    }
}
